inspector: Show object title in the classes tab
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Nov 2014 18:41:21 +0000 (13:41 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 23 Nov 2014 02:38:47 +0000 (21:38 -0500)
gtk/inspector/classes-list.c
gtk/inspector/classes-list.ui

index 1fc313082cb0441a92fd25ca087dffae41e308ac..04fe934f6fcc4898abc3432e08c45277cbfc0bac 100644 (file)
@@ -31,6 +31,7 @@
 #include "gtkbutton.h"
 #include "gtkdialog.h"
 #include "gtkstylecontext.h"
+#include "gtklabel.h"
 
 enum
 {
@@ -49,6 +50,7 @@ struct _GtkInspectorClassesListPrivate
 {
   GtkListStore *model;
   GtkStyleContext *context;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
@@ -257,6 +259,7 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
   GHashTable *hash_context;
   GtkTreeIter tree_iter;
   GtkInspectorClassesListByContext *c;
+  const gchar *title;
 
   cleanup_context (cl);
 
@@ -272,6 +275,9 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
 
   g_object_weak_ref (G_OBJECT (cl->priv->context), gtk_inspector_classes_list_remove_dead_object, cl);
 
+  title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+  gtk_label_set_label (GTK_LABEL (cl->priv->object_title), title);
+
   hash_context = get_hash_context (cl);
   if (hash_context)
     {
@@ -313,6 +319,7 @@ gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, object_title);
   gtk_widget_class_bind_template_callback (widget_class, add_clicked);
   gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
   gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
index 05e08fa941ef40d967f7de5e32ccc54449935e99..0414dd4756fd2640b1d99b1b352c89f871adf3e0 100644 (file)
   <template class="GtkInspectorClassesList" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
-      <object class="GtkToolbar">
+      <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="icon-size">small-toolbar</property>
+        <property name="orientation">horizontal</property>
+        <property name="spacing">6</property>
+        <property name="margin">6</property>
         <child>
-          <object class="GtkToolButton">
+          <object class="GtkButton">
             <property name="visible">True</property>
-            <property name="icon-name">list-add-symbolic</property>
+            <property name="relief">none</property>
             <property name="tooltip-text" translatable="yes">Add a class</property>
             <signal name="clicked" handler="add_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">list-add-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
           </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
         </child>
         <child>
-          <object class="GtkToolButton">
+          <object class="GtkButton">
             <property name="visible">True</property>
-            <property name="icon-name">edit-undo-symbolic</property>
+            <property name="relief">none</property>
             <property name="tooltip-text" translatable="yes">Restore defaults for this widget</property>
             <signal name="clicked" handler="restore_defaults_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">edit-undo-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+        <child type="center">
+          <object class="GtkLabel" id="object_title">
+            <property name="visible">True</property>
           </object>
         </child>
       </object>